//
//  MYGMedicalBookTableViewCell.swift
//  MYDoctor
//
//  Created by 王振明 on 2024/4/18.
//

import UIKit

class MYGMedicalBookTableViewCell: UITableViewCell {
    var mode:MYGCaseClasmListModel = MYGCaseClasmListModel(){
        didSet{
            hospitalLabel.text = mode.outpatient.hospital
            contentLab.text = "诊断: \(mode.outpatient.info)"
            if mode.outpatient.doctor.count > 0{
                doctorLabel.text = "医生: \(mode.outpatient.doctor)"
            }
        }
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        initUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    private func initUI(){

        contentView.addSubview(bottomView)
        bottomView.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(19)
            make.right.equalToSuperview().offset(-19)
            make.top.equalToSuperview()
            make.height.equalTo(77.5)
        }
        bottomView.addSubview(hospitalLabel)
        hospitalLabel.snp.makeConstraints { make in
            make.left.top.equalToSuperview().offset(14.5)
            make.height.equalTo(21)
        }
        
        bottomView.addSubview(doctorLabel)
        doctorLabel.snp.makeConstraints { make in
            make.centerY.equalTo(hospitalLabel)
            make.left.equalTo(hospitalLabel.snp.right).offset(10)
            make.height.equalTo(21)
        }
        
        bottomView.addSubview(contentLab)
        contentLab.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(14.5)
            make.top.equalTo(hospitalLabel.snp.bottom).offset(10)
            make.height.equalTo(16.5)
        }
        bottomView.addSubview(imageV)
        imageV.snp.makeConstraints { make in
            make.left.equalTo(contentLab.snp.right).offset(8)
            make.centerY.equalTo(contentLab)
            make.height.equalTo(28)
            make.width.equalTo(35)
        }
        bottomView.addSubview(moreImage)
        moreImage.snp.makeConstraints { make in
            make.right.equalToSuperview().offset(-8.5)
            make.top.equalToSuperview().offset(17.5)
            make.size.equalTo(CGSize(width: 6, height: 11))
        }
    }
    private lazy var bottomView:UIView = {
        let vi = UIView()
        vi.backgroundColor = .white
        vi.layer.shadowColor = RGBA(r: 200, g: 200, b: 200, a: 0.5).cgColor
        vi.layer.shadowOffset = CGSize(width: 2, height: 2)
        vi.layer.shadowRadius = 4.5
        vi.layer.shadowOpacity = 1
        return vi
    }()
    lazy var hospitalLabel: UILabel = {
        let cont = UILabel()
        cont.text = "背景医院"
        cont.font = .medium(15)
        cont.textColor = .rgba(70, 70, 70)
        return cont
    }()
    lazy var doctorLabel: UILabel = {
        let cont = UILabel()
        cont.text = ""
        cont.font = .regular(12)
        cont.textColor = .rgba(152, 152, 152)
        return cont
    }()
    lazy var moreImage: UIImageView = {
        let cont = UIImageView()
        cont.image = UIImage(named: "MYG_home_moreJ")
        return cont
    }()
    lazy var contentLab: UILabel = {
        let cont = UILabel()
        cont.text = ""
        cont.font = .regular(12)
        cont.textColor = .rgba(152, 152, 152)
        return cont
    }()
    lazy var imageV: UIImageView = {
        let cont = UIImageView()
        cont.contentMode = .scaleAspectFill
        return cont
    }()
//    lazy var imageV: UIImageView = {
//        let cont = UIImageView()
//        cont.contentMode = .scaleAspectFill
//        return cont
//    }()
//    lazy var imageV: UIImageView = {
//        let cont = UIImageView()
//        cont.contentMode = .scaleAspectFill
//        return cont
//    }()
}
